<html>
<head><meta charset="utf-8"><title>docopt compatible subcommands in and out of cargo · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html">docopt compatible subcommands in and out of cargo</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223427923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223427923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223427923">(Jan 20 2021 at 20:07)</a>:</h4>
<p>I'm working on <a href="https://github.com/google/cargo-raze">https://github.com/google/cargo-raze</a> and have run into an issue where arguments no longer work when the tool is used as a cargo subcommand. I'm wondering if anyone can help me figure this out. I want the tool to work both as a cargo subcommand and as a standalone binary. Everything works currently through direct invocations but the subcommand doesn't accept any flags. </p>
<div class="codehilite"><pre><span></span><code>RUST_BACKTRACE=1 cargo raze --manifest-path=./examples/vendored/hello_cargo_library/Cargo.toml
</code></pre></div>
<div class="codehilite"><pre><span></span><code>Invalid arguments.

Usage:
    cargo raze (-h | --help)
    cargo raze (-V | --version)
    cargo raze [--verbose] [--quiet] [--color=&lt;WHEN&gt;] [--dryrun] [--cargo-bin-path=&lt;PATH&gt;]
               [--manifest-path=&lt;PATH&gt;] [--output=&lt;PATH&gt;] [--generate-lockfile]
</code></pre></div>
<p>The tool receives the following args (I added a print to generate this)</p>
<div class="codehilite"><pre><span></span><code>!!!!! Args { inner: [&quot;/Users/user/.cargo/bin/cargo-raze&quot;, &quot;raze&quot;, &quot;--manifest-path=./examples/vendored/hello_cargo_library/Cargo.toml&quot;] }
</code></pre></div>
<p>Any idea how to magic my way through docopt to get this to work correctly in both cases?</p>



<a name="223428867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223428867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223428867">(Jan 20 2021 at 20:14)</a>:</h4>
<p>Sorry if this isn't quite the place for this kind of question. My thought was maybe someone here would have run into this before.</p>



<a name="223431721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223431721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223431721">(Jan 20 2021 at 20:37)</a>:</h4>
<p><span class="user-mention" data-user-id="343063">@UebelAndre</span> cargo passes <code>raze</code> as the first argument</p>



<a name="223431735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223431735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223431735">(Jan 20 2021 at 20:37)</a>:</h4>
<p>You have to add logic yourself to skip it</p>



<a name="223432095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223432095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223432095">(Jan 20 2021 at 20:40)</a>:</h4>
<p>ah got it, thanks <span aria-label="pray" class="emoji emoji-1f64f" role="img" title="pray">:pray:</span></p>



<a name="223469292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223469292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223469292">(Jan 21 2021 at 04:36)</a>:</h4>
<p><span class="user-mention" data-user-id="343063">@UebelAndre</span> are you interested in <code>-Z build-std</code> by  any chance, because I am in part because working on things analogous to raze (which looks neat, btw).</p>



<a name="223931200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223931200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223931200">(Jan 25 2021 at 17:25)</a>:</h4>
<p>Hey, sorry for the delay. I’m not sure what that flag does. Can you link me to an article or something describing it?</p>



<a name="223932032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/docopt%20compatible%20subcommands%20in%20and%20out%20of%20cargo/near/223932032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/docopt.20compatible.20subcommands.20in.20and.20out.20of.20cargo.html#223932032">(Jan 25 2021 at 17:31)</a>:</h4>
<p><a href="https://doc.rust-lang.org/cargo/reference/unstable.html#build-std">https://doc.rust-lang.org/cargo/reference/unstable.html#build-std</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>